package com.kclm.ssm.response;

/**
 * @Author : lvhx
 * @Date: 2025/11/10 14:15
 * @Description:
 * 封装响应的统一结果
 */
public class Result {
    private  Integer code;
    private  String msg;
    private  Object data;

    public Result(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public Result(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public static Result  success(){
        return new Result(200,"success");
    }
    public static Result  success(String msg,Object data){
        return new Result(200,msg,data);
    }
    public static Result  failure(){
        return new Result(500,"failure");
    }
    public static Result  failure(String msg){
        return new Result(500,msg);
    }


    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
